<?php

/**
 * Entry form base class.
 *
 * @method Entry getObject() Returns the current form's model object
 *
 * @package    berta-s
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedInheritanceTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseEntryForm extends ExpandoForm
{
  protected function setupInheritance()
  {
    parent::setupInheritance();

    $this->widgetSchema   ['name'] = new sfWidgetFormInputText();
    $this->validatorSchema['name'] = new sfValidatorString(array('max_length' => 120, 'required' => false));

    $this->widgetSchema   ['content'] = new sfWidgetFormTextarea();
    $this->validatorSchema['content'] = new sfValidatorString(array('required' => false));

    $this->widgetSchema   ['section_id'] = new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Section'), 'add_empty' => true));
    $this->validatorSchema['section_id'] = new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Section'), 'required' => false));

    $this->widgetSchema   ['published'] = new sfWidgetFormInputCheckbox();
    $this->validatorSchema['published'] = new sfValidatorBoolean(array('required' => false));

    $this->widgetSchema   ['datetime'] = new sfWidgetFormDateTime();
    $this->validatorSchema['datetime'] = new sfValidatorDateTime(array('required' => false));

    $this->widgetSchema   ['position_x'] = new sfWidgetFormInputText();
    $this->validatorSchema['position_x'] = new sfValidatorInteger(array('required' => false));

    $this->widgetSchema   ['position_y'] = new sfWidgetFormInputText();
    $this->validatorSchema['position_y'] = new sfValidatorInteger(array('required' => false));

    $this->widgetSchema   ['slug'] = new sfWidgetFormInputText();
    $this->validatorSchema['slug'] = new sfValidatorString(array('max_length' => 120, 'required' => false));

    $this->widgetSchema   ['position'] = new sfWidgetFormInputText();
    $this->validatorSchema['position'] = new sfValidatorInteger(array('required' => false));

    $this->widgetSchema   ['created_at'] = new sfWidgetFormDateTime();
    $this->validatorSchema['created_at'] = new sfValidatorDateTime();

    $this->widgetSchema   ['updated_at'] = new sfWidgetFormDateTime();
    $this->validatorSchema['updated_at'] = new sfValidatorDateTime();

    $this->widgetSchema->setNameFormat('entry[%s]');
  }

  public function getModelName()
  {
    return 'Entry';
  }

}
